/**
 * @file frame.h
 * @author your name (you@domain.com)
 * @brief ui frame for event distribute
 * @version 0.1
 * @date 2023-05-28
 * 
 * @copyright Copyright (c) 2023
 * 
 */
#ifndef FRAME_H
#define FRAME_H


#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "log.h"
#include "msg_com.h"
#include "ui_basic.h"

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * @brief ui frame init
 * 
 * @return int -1 error 0 success
 */
int easy_ui_frame_init();

/**
 * @brief ui frame loop
 * 
 * @return int -1 error 0 success
 */
int easy_ui_frame_loop();

/**
 * @brief ui frame deinit
 * 
 * @return int -1 error 0 success
 */
int easy_ui_frame_deinit();

/**
 * @brief publish event msg
 * 
 * @param event 
 * @param data 
 * @param datalen 
 * @param srcId 
 * @return int 
 */
int easy_ui_pub_event(char *event, void *data, int datalen, int srcId);

/**
 * @brief sub event msg
 * 
 * @param event 
 * @param func 
 * @param needId 
 * @return int 
 */
int easy_ui_sub_event(char *event, HandleEvent func, int needId);

/**
 * @brief cancel sub event
 * 
 * @param event 
 * @param func 
 * @return int 
 */
int easy_ui_sub_event_cancel(char *event, HandleEvent func);


#ifdef __cplusplus
}
#endif


#endif